(Add monster's experience to Boy's and Dog's, then level them up
 and adjust their stats when necessary.  They'll gain at most one
 level per call.)

8F/827A: AD 61 22     LDA $2261
8F/827D: 89 02 00     BIT #$0002   (is Boy's gauge absent?  probably means
                                    boy isn't in party)
8F/8280: F0 03        BEQ $8285
8F/8282: 4C BA 82     JMP $82BA    (if it is, skip to Dog)

                                   (who's up for a game of leapfrog?  a single
                                    relative branch [BNE] would have reached
                                    8F/82BA just fine in place of these two jump
                                    instructions..)

8F/8285: A4 4C        LDY $4C
8F/8287: BE 60 00     LDX $0060,Y  (get pointer to data of slain monster?)
8F/828A: AD 50 0A     LDA $0A50    (Boy's level)
8F/828D: C9 63 00     CMP #$0063
8F/8290: 10 28        BPL $82BA      (branch if it's >= 99)
8F/8292: BF 23 00 8E  LDA $8E0023,X  (bottom two bytes of experience given
                                      by monster)
8F/8296: 18           CLC
8F/8297: 6D 49 0A     ADC $0A49
8F/829A: 8D 49 0A     STA $0A49      (add to Boy's current experience)
8F/829D: BF 25 00 8E  LDA $8E0025,X  (top two bytes of experience given by
                                      monster)
8F/82A1: 6D 4B 0A     ADC $0A4B
8F/82A4: 8D 4B 0A     STA $0A4B      (add to Boy's current experience)
8F/82A7: CD 1F 4F     CMP $4F1F      (compare top two bytes of Boy's current
                                      experience to top two bytes of the total
                                      experience needed to reach the next level)
8F/82AA: 30 0E        BMI $82BA      (if they're less, we know the overall current
                                      experience is less than the amount needed,
                                      so skip to checking the dog)
8F/82AC: D0 08        BNE $82B6      (if they're more, we know the overall current
                                      experience exceeds the amount needed, so
                                      go level-up the boy)
8F/82AE: AD 49 0A     LDA $0A49      (or if the top two bytes matched,)
8F/82B1: CD 1D 4F     CMP $4F1D      (compare bottom two bytes of Boy's current
                                      experience to top two bytes of exp. needed
                                      for next level)
8F/82B4: 90 04        BCC $82BA      (if they're less, he doesn't have enough
                                      overall experience, so branch)
8F/82B6: 22 10 83 8F  JSL $8F8310    (increase boy's level, adjust his stats
                                      accordingly, etc)


8F/82BA: AD 61 4F     LDA $4F61
8F/82BD: F0 3D        BEQ $82FC    (exit if dog's HP is zero)
8F/82BF: AD 61 22     LDA $2261
8F/82C2: 89 01 00     BIT #$0001   (is Dog's gauge display absent?  probably
                                    means Dog isn't in party)
8F/82C5: D0 35        BNE $82FC    (if it is, exit function)
8F/82C7: A4 4C        LDY $4C
8F/82C9: BE 60 00     LDX $0060,Y  (get pointer to data of slain monster?)
8F/82CC: AD 9A 0A     LDA $0A9A    (Dog's level)
8F/82CF: C9 63 00     CMP #$0063
8F/82D2: 10 28        BPL $82FC      (branch if it's >= 99)
8F/82D4: BF 23 00 8E  LDA $8E0023,X  (bottom two bytes of experience given
                                      by monster)
8F/82D8: 18           CLC
8F/82D9: 6D 93 0A     ADC $0A93
8F/82DC: 8D 93 0A     STA $0A93      (add to Dog's current experience)
8F/82DF: BF 25 00 8E  LDA $8E0025,X  (top two bytes of experience given by
                                      monster)
8F/82E3: 6D 95 0A     ADC $0A95
8F/82E6: 8D 95 0A     STA $0A95      (add to Dog's current experience)
8F/82E9: CD CD 4F     CMP $4FCD      (compare top two bytes of Dog's current
                                      experience to top two bytes of the total
                                      experience needed to reach the next level)
8F/82EC: 30 0E        BMI $82FC      (if they're less, we know the overall current
                                      experience is less than the amount needed,
                                      so exit)
8F/82EE: D0 08        BNE $82F8      (if they're more, we know the overall current
                                      experience exceeds the amount needed, so
                                      go level-up the dog)
8F/82F0: AD 93 0A     LDA $0A93      (or if the top two bytes matched,)
8F/82F3: CD CB 4F     CMP $4FCB      (compare bottom two bytes of Dog's current
                                      experience to top two bytes of exp. needed
                                      for next level)
8F/82F6: 30 04        BMI $82FC      (if they're less [?], the pooch doesn't have
                                      enough overall experience, so branch.
                                      
                                      BZZT!!  getting a positive value from the
                                      subtraction doesn't necessarily mean the
                                      first value is >= the second.  if you have
                                      a really small value minus a really large
                                      one, the result will be interpreted as a
                                      a *positive* integer by the computer because
                                      16-bit signed integers can't represent a
                                      value below -32768.  this leads to the bug
                                      with the dog's erratic levelling.)

                                      I don't know why the Dog didn't get a BCC
                                      like the Boy, who is bugless.)

8F/82F8: 22 F5 84 8F  JSL $8F84F5    (increase dog's level, adjust his stats
                                      accordingly, etc)
8F/82FC: 6B           RTL


===============================================================================


(Boy gains a level, receives any accompanying stat boosts, and a message
 is queued.)

8F/8310: AD 50 0A     LDA $0A50   (get Boy's level)
8F/8313: C9 63 00     CMP #$0063
8F/8316: 30 03        BMI $831B
8F/8318: 4C 87 83     JMP $8387   (if it's >= 99, exit function)
8F/831B: 1A           INC 
8F/831C: 8D 50 0A     STA $0A50   (increment and save updated level)
8F/831F: 85 02        STA $02
8F/8321: 64 04        STZ $04     (also save the level in $00:0002 thru $00:0005,
                                   so the 80/B21F call can put its digits in a
                                   display buffer)
8F/8323: 22 98 83 8F  JSL $8F8398 (adjust boy's stats to account for his new
                                   level.  normally, they just grow, but because
                                   a stat's value at each level is stored
                                   separately, they could easily be hacked to
                                   decrease.)
8F/8327: AD 35 0A     LDA $0A35
8F/832A: 8D B3 4E     STA $4EB3   (current HP = max HP)
8F/832D: AD 50 0A     LDA $0A50
8F/8330: 0A           ASL 
8F/8331: 18           CLC 
8F/8332: 6D 50 0A     ADC $0A50
8F/8335: AA           TAX            (use level * 3 as pointer to "Experience
                                      Needed" table, as each entry is 3 bytes)
8F/8336: BF D1 8B 8C  LDA $8C8BD1,X
8F/833A: 8D 1E 4F     STA $4F1E      (save total experience needed for boy
                                      to reach next level, top 2 bytes)
8F/833D: BF D0 8B 8C  LDA $8C8BD0,X 
8F/8341: 8D 1D 4F     STA $4F1D      (save total experience needed for boy
                                      to reach next level, bottom byte)
8F/8344: A9 22 7E     LDA #$7E22
8F/8347: 85 27        STA $27
8F/8349: A9 10 22     LDA #$2210
8F/834C: 85 26        STA $26       (point to 7E/2210, boy's name in RAM)
8F/834E: 22 7A B3 80  JSL $80B37A   (initialize a buffer pointer in $0022 thru $0024;
                                     the Bank is 7E, and the Offset is the value
                                     of variable $0B57)
8F/8352: A5 22        LDA $22
8F/8354: 85 12        STA $12       (save pointer to the beginning of the text
                                     buffer we're about to fill and display)
8F/8356: 22 49 B1 80  JSL $80B149   (put boy's name in text buffer)
8F/835A: 98           TYA 
8F/835B: 18           CLC 
8F/835C: 65 22        ADC $22
8F/835E: 85 22        STA $22       (increment buffer pointer by # of
                                     characters stored by above call)
8F/8360: A9 88 83     LDA #$8388
8F/8363: 85 26        STA $26
8F/8365: A9 8F 00     LDA #$008F
8F/8368: 85 28        STA $28       ($00:0026 thru $00:0028 points to 8F/8388)
8F/836A: 22 49 B1 80  JSL $80B149   (add " reaches level " to display buffer)
8F/836E: 98           TYA 
8F/836F: 18           CLC 
8F/8370: 65 22        ADC $22
8F/8372: 85 22        STA $22       (increment buffer pointer by # of
                                     characters stored by above call)
8F/8374: 22 1F B2 80  JSL $80B21F   (turn a 32-bit number, stored in $00:0002
                                     thru $00:0005, into text and add it to
                                     display buffer.  in this case, it's the
                                     level number we're displaying.)
8F/8378: A5 12        LDA $12
8F/837A: 85 22        STA $22       (get pointer to beginning of text buffer)
8F/837C: 22 21 C5 8C  JSL $8CC521   (now output the whole string?
                                     "[Boy's name] reaches level NN")
8F/8380: A2 89 4E     LDX #$4E89
8F/8383: 22 44 91 8F  JSL $8F9144   (???)
8F/8387: 6B           RTL 


-------------------------


(" reaches level " text.
 holy shat!!  ASCII in a game?!  that's a novel idea..)

8F/8388: 20  (space)
8F/8389: 72  ("r")
8F/838A: 65  ("e")  
8F/838B: 61  ("a") 
8F/838C: 63  ("c")
8F/838D: 68  ("h")
8F/838E: 65  ("e")
8F/838F: 73  ("s")
8F/8390: 20  (space)
8F/8391: 6C  ("l")
8F/8392: 65  ("e")
8F/8393: 76  ("v")
8F/8394: 65  ("e")
8F/8395: 6C  ("l")
8F/8396: 20  (space)
8F/8397: 00  (null terminator)


===============================================================================


(Dog gains a level, receives any accompanying stat boosts, and a message
 is queued.)

8F/84F5: AD 9A 0A     LDA $0A9A    (get Dog's level)
8F/84F8: C9 63 00     CMP #$0063
8F/84FB: 30 03        BMI $8500
8F/84FD: 4C 6C 85     JMP $856C    (if it's >= 99, exit function)
8F/8500: 1A           INC 
8F/8501: 8D 9A 0A     STA $0A9A    (increment and save updated level)
8F/8504: 85 02        STA $02
8F/8506: 64 04        STZ $04      (also save the level in $00:0002 thru $00:0005,
                                    so the 80/B21F call can put its digits in a
                                    display buffer)
8F/8508: 22 7D 85 8F  JSL $8F857D  (adjust dog's stats to account for its new
                                    level.  normally, they just grow, but because
                                    a stat's value at each level is stored
                                    separately, they could easily be hacked to
                                    decrease.)
8F/850C: AD 7F 0A     LDA $0A7F
8F/850F: 8D 61 4F     STA $4F61    (current HP = max HP)
8F/8512: AD 9A 0A     LDA $0A9A
8F/8515: 0A           ASL 
8F/8516: 18           CLC 
8F/8517: 6D 9A 0A     ADC $0A9A
8F/851A: AA           TAX            (use level * 3 as pointer to "Experience
                                      Needed" table, as each entry is 3 bytes)
8F/851B: BF FD 8C 8C  LDA $8C8CFD,X
8F/851F: 8D CC 4F     STA $4FCC      (save total experience needed for dog
                                      to reach next level, top 2 bytes)
8F/8522: BF FC 8C 8C  LDA $8C8CFC,X
8F/8526: 8D CB 4F     STA $4FCB      (save total experience needed for dog
                                      to reach next level, bottom byte)
8F/8529: A9 22 7E     LDA #$7E22
8F/852C: 85 27        STA $27
8F/852E: A9 34 22     LDA #$2234
8F/8531: 85 26        STA $26       (point to 7E/2234, dog's name in RAM)
8F/8533: 22 7A B3 80  JSL $80B37A   (initialize a buffer pointer in $0022 thru $0024;
                                     the Bank is 7E, and the Offset is the value
                                     of variable $0B57)
8F/8537: A5 22        LDA $22
8F/8539: 85 12        STA $12       (save pointer to the beginning of the text
                                     buffer we're about to fill and display)
8F/853B: 22 49 B1 80  JSL $80B149   (put dog's name in text buffer)
8F/853F: 98           TYA 
8F/8540: 18           CLC 
8F/8541: 65 22        ADC $22
8F/8543: 85 22        STA $22       (increment buffer pointer by # of
                                     characters stored by above call)
8F/8545: A9 6D 85     LDA #$856D
8F/8548: 85 26        STA $26
8F/854A: A9 8F 00     LDA #$008F
8F/854D: 85 28        STA $28       ($00:0026 thru $00:0028 points to 8F/856D)
8F/854F: 22 49 B1 80  JSL $80B149   (add " reaches level " to display buffer)
8F/8553: 98           TYA 
8F/8554: 18           CLC 
8F/8555: 65 22        ADC $22
8F/8557: 85 22        STA $22       (increment buffer pointer by # of
                                     characters stored by above call)
8F/8559: 22 1F B2 80  JSL $80B21F   (turn a 32-bit number, stored in $00:0002
                                     thru $00:0005, into text and add it to
                                     display buffer.  in this case, it's the
                                     level number we're displaying.)
8F/855D: A5 12        LDA $12
8F/855F: 85 22        STA $22       (get pointer to beginning of text buffer)
8F/8561: 22 21 C5 8C  JSL $8CC521   (now output the whole string?
                                     "[Dog's name] reaches level NN")
8F/8565: A2 37 4F     LDX #$4F37
8F/8568: 22 44 91 8F  JSL $8F9144   (???)
8F/856C: 6B           RTL


-------------------------


(" reaches level " text.
 holy shat!!  ASCII in a game?!  that's a novel idea..)

8F/856D: 20  (space)
8F/856E: 72  ("r")
8F/856F: 65  ("e")
8F/8570: 61  ("a")
8F/8571: 63  ("c")
8F/8572: 68  ("h")
8F/8573: 65  ("e")
8F/8574: 73  ("s")
8F/8575: 20  (space)
8F/8576: 6C  ("l")
8F/8577: 65  ("e")
8F/8578: 76  ("v")
8F/8579: 65  ("e")
8F/857A: 6C  ("l")
8F/857B: 20  (space)
8F/857C: 00  (null terminator)

